package sample.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import sample.web.model.Permisson;
import sample.web.service.UserService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * Created by zhaopeng on 2/29/16.
 */
@Controller
public class IndexController {

    @Autowired
    private UserService userService;

    @RequestMapping("/index")
    public String index(Map<String, Object> model, HttpServletRequest request){
        Integer roleid = (Integer) request.getSession().getAttribute("roleid");
        List<Permisson> permissons=userService.findByRoleId(roleid);
        model.put("list",permissons);
        return "/user/list";
    }
}
